package com.sq.partner.manager.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.ITradNoticePartnerMtDao;
import com.sq.partner.manager.mybatis.model.TradNoticePartner;
import com.sq.partner.manager.util.StrUtil;
/**
 * 
 * @author zzguo
 *
 */
@Repository
public class ITradNoticePartnerMtDaoImpl extends BaseDaoImpl implements ITradNoticePartnerMtDao {
	@SuppressWarnings("unchecked")
	@Override
	public List<TradNoticePartner> queryTreeDtoByPriBranchCode(
			String deptCodeStr) throws Exception {
		if(StrUtil.isEmpty(deptCodeStr)){
			return this.queryList("queryTradNoticePartnerByHQ", "");
		}else{
			return this.queryList("queryTradNoticePartnerByPriBranch", deptCodeStr.substring(0, deptCodeStr.length()-1));
		}
	}

	@Override
	public boolean addTradNoticePartnerInfo(List<TradNoticePartner> list) throws Exception {
		if(null!=list && list.size()>0){
			return this.add("insertTradNoticePartner", list);
		}
		return false;
	}

	@Override
	public boolean delTradNoticePartnerInfo(String noticeId) throws Exception {
		return this.delete("delTradNoticePartnerById", noticeId);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<TradNoticePartner> queryRelationInfoByNoticeId(String noticeId)
			throws Exception {
		return this.queryList("queryNoticePartnerRelationshipByNoticeId", noticeId);
	} 
	
}
